//
//  KKImagePickerManager+Tools.m
//  KKImagePickerController
//
//  Created by liaozhenming on 16/3/11.
//  Copyright © 2016年 JuniorCodingPerson. All rights reserved.
//

#import "KKImagePickerManager+Tools.h"

@implementation KKImagePickerManager (Tools)

+ (void)kk_showErrorMessage:(NSString *)message {
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        if (message == nil) {
            return;
        }
        
        if (KKDeviceVersion < 8.0) {
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle: @"提示" message: message delegate: nil cancelButtonTitle: @"关闭" otherButtonTitles: nil];
            [alertView show];
            return;
        }
        else {
            UIAlertController *alertController = [UIAlertController alertControllerWithTitle: @"提示" message: message preferredStyle: UIAlertControllerStyleAlert];
            UIAlertAction *cancelAction = [UIAlertAction actionWithTitle: @"关闭" style:UIAlertActionStyleCancel handler: nil];
            [alertController addAction: cancelAction];
            
            UIViewController *rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
            
            [rootViewController presentViewController: alertController animated: true completion: nil];
        }
    });
}

@end
